package com.jomoo.css.common.util.security;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;


@Getter
@Setter
@JsonIgnoreProperties(ignoreUnknown = true)
public class AuthorizationLogin
{
    // 登录类型  // 用户名密码登录，Philip授权登录，经销商手机号登录
    private String type;

    private String domain;

//    @NotBlank(message="用户名不能为空")
    private String loginname;

//    @NotBlank(message="密码不能为空")
    private String password;

    // 手机号码
    private String telephone;

    // 验证码
    private String captcha;

    // userCode
    private String userCode;

    // 授权登录的code
    private String code;


    public String getUsername()
    {
        if(!StringUtils.isEmpty(domain))
            return loginname+"|"+domain;
        return loginname;
    }


    @Override
    public String toString()
    {
        return "AuthorizationLogin{" +
                "domain='" + domain + '\'' +
                ", loginname='" + loginname + '\'' +
                ", password='××××××'}";
    }
}
